* APPENDIX M

clear all	
cd "${data}"	
use "data1.dta", clear 

gen daysafter_15 = daysafter if daysafter<16
gen daysafter_30 = daysafter if daysafter<31
gen daysafter_60 = daysafter if daysafter<61
gen daysafter_90 = daysafter if daysafter<91
gen daysafter_120 = daysafter if daysafter<121
gen daysafter_150 = daysafter if daysafter<151


eststo m1: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<16 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(1)15)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 15 days") addplot(hist daysafter_15, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(1)15)) xlabel(0(1)15) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_15.gph", replace


eststo m2: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<31 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(1)30)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 30 days") addplot(hist daysafter_30, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(1)30)) xlabel(0(1)30) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_30.gph", replace



eststo m3: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<61 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(15)60)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 60 days") addplot(hist daysafter_60, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(15)60)) xlabel(0(15)60) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_60.gph", replace


eststo m4: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<91 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(15)90)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 90 days") addplot(hist daysafter_90, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(15)90)) xlabel(0(15)90) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_90.gph", replace

eststo m5: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<121 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(15)120)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 120 days") addplot(hist daysafter_120, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(15)120)) xlabel(0(15)120) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_120.gph", replace

eststo m6: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter<151 || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(0(15)150)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("first 150 days") addplot(hist daysafter_150, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)25) axis(2) alt)) legend(off) xscale(range(0(15)150)) xlabel(0(15)150) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))


graph save "${figures}/figure1_150.gph", replace

cd "${tables}"
* TABLE M.1: Late Interviews Do Not Drive the Results
esttab m1 m2 m3 m4 m5 m6 using tableM1.tex, replace ///
b(3) se(3) nogap transform(ln*: exp(2*@) 2*exp(2*@))


cd "${figures}"

*FIGURE M.1: Late Interviews Do Not Drive the Results
graph combine "figure1_15.gph" "figure1_30.gph" "figure1_60.gph" "figure1_90.gph" "figure1_120.gph" "figure1_150.gph" , ycommon l1("AME of a one-unit change in expert party position")
graph save "figureM1.gph", replace
graph export "figureM1.png", replace



clear all	
cd "${data}"	
use "data1.dta", clear 

gen daysafter_custom = daysafter if daysafter>9 & daysafter<101
gen daysafter_custom2 = daysafter if daysafter>9 & daysafter<300


eststo m1: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter_custom!=. || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(10(10)100)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("") addplot(hist daysafter_custom, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)20) axis(2) alt)) legend(off) xscale(range(10(10)100)) xlabel(15(15)100) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))

graph save "${figures}/figure1_custom.gph", replace

eststo m2: mixed c.IMD3007_ c.daysafter##c.IMD5012_ if daysafter_custom2!=. || country_: || election_: || respondent: IMD5012_ 
margins, dydx(IMD5012_) at(daysafter=(10(30)300)) post
marginsplot, ytitle("AME of a one-unit change in expert party position", size(3)) recastci(rarea) ciopt(color(gs12%50))level(95) recast(line) plot1opts(color(gs12%50) lpattern(shortdash)) title("") addplot(hist daysafter_custom2, percent color(gs12%50) yaxis(2) ytitle("percent", size(3) axis(2)) yscale(range(0(5)20) axis(2) alt)) legend(off) xscale(range(10(30)300)) xlabel(10(30)300) plotr(lp(solid) lcolor(black)) xtitle("days since election", size(3))

graph save "${figures}/figure1_custom2.gph", replace

* * FIGURE M.2: Early Interviews Do Not Drive the Results 

cd "${figures}"
graph combine figure1_custom.gph figure1_custom2.gph , ycommon
graph save "figureM2.gph", replace
graph export "figureM2.png", replace 

* TABLE M.2: Early Interviews Do Not Drive the Results 

cd "${tables}"
esttab m1 m2 using tableM2.tex, replace ///
b(3) se(3) nogap transform(ln*: exp(2*@) 2*exp(2*@))
